/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.mlbs.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author mckd87
 */
@Entity
@Table(name = "application")
@NamedQueries({@NamedQuery(name = "Application.findByAppId", query = "SELECT a FROM Application a WHERE a.appId = :appId"), @NamedQuery(name = "Application.findByApplicationName", query = "SELECT a FROM Application a WHERE a.applicationName = :applicationName"), @NamedQuery(name = "Application.findByDescription", query = "SELECT a FROM Application a WHERE a.description = :description"), @NamedQuery(name = "Application.findByOwner", query = "SELECT a FROM Application a WHERE a.owner = :owner")})
public class Application implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Column(name = "appId", nullable = false)
    private Integer appId;
    @Column(name = "applicationName")
    private String applicationName;
    @Column(name = "description")
    private String description;
    @Column(name = "owner")
    private String owner;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "appId")
    private Collection<Appusage> appusageCollection;
    @OneToMany(mappedBy = "appId")
    private Collection<Preferences> preferencesCollection;

    public Application() {
    }

    public Application(Integer appId) {
        this.appId = appId;
    }

    public Integer getAppId() {
        return appId;
    }

    public void setAppId(Integer appId) {
        this.appId = appId;
    }

    public String getApplicationName() {
        return applicationName;
    }

    public void setApplicationName(String applicationName) {
        this.applicationName = applicationName;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getOwner() {
        return owner;
    }

    public void setOwner(String owner) {
        this.owner = owner;
    }

    public Collection<Appusage> getAppusageCollection() {
        return appusageCollection;
    }

    public void setAppusageCollection(Collection<Appusage> appusageCollection) {
        this.appusageCollection = appusageCollection;
    }

    public Collection<Preferences> getPreferencesCollection() {
        return preferencesCollection;
    }

    public void setPreferencesCollection(Collection<Preferences> preferencesCollection) {
        this.preferencesCollection = preferencesCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (appId != null ? appId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Application)) {
            return false;
        }
        Application other = (Application) object;
        if ((this.appId == null && other.appId != null) || (this.appId != null && !this.appId.equals(other.appId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.mlbs.entity.Application[appId=" + appId + "]";
    }

}
